﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSerialPort>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void handleReadyRead();
    void handleError(QSerialPort::SerialPortError error);

private slots:
    void on_sendMsgButton_clicked();

    void on_connectButton_clicked();

    void on_sendMsgButton_2_clicked();

signals:
    void serialDataReadFinished();

private:
    void writeMsg(QString str);
    bool waiteForReadyRead(int msec);

    Ui::MainWindow *ui;

    QSerialPort *m_serialPort;
    QByteArray m_recvData;
};

#endif // MAINWINDOW_H
